home *** CD-ROM | disk | FTP | other *** search
/ The Arsenal Files 6 / The Arsenal Files 6 (Arsenal Computer).ISO / os2bbs / ftpfid16.zip / HANGUP.CMD < prev    next >
OS/2 REXX Batch file  |  1996-02-16  |  2KB  |  88 lines

  1. /* Hangup.cmd */
  2. parse arg ftproc
  3. hangflg = 'f:\bbs\logs\hangup.flg'
  4. flg = 'f:\bbs\logs\Doing_ftp.flg' /* process flag */
  5. hisbsy = 'f:\binkley\outbound\018c0001.bsy'
  6. binkflg = 'f:\bbs\binkley\flags\task.03'
  7. maxflg = 'f:\bbs\max\system\active03.bbs'
  8. ftpin = 'd:\ftpin\*.*'
  9. tcpbin = 'd:\tcpip\bin'
  10. a = 0
  11. b = 0
  12. abort = 0
  13. thistime = 0
  14. lastime = 0
  15.  
  16. elapsed = time('e')
  17.  
  18. do forever
  19.  Select
  20.  
  21.    When Stream(flg,'C', 'Query Exists') <>' ' Then
  22.     Do
  23.     rc = SysFileTree(ftpin,files.,"F")
  24.     if a > 2 then
  25.         do
  26.     'go -k 'ftproc /* process killer. ftproc is the PID */
  27.         abort = 1
  28.         signal Ttyl
  29.         end
  30.     if files.0 > 0 then
  31.      do
  32.       if b > 9 | b = 0 then 
  33.        do
  34.        thistime = files.0
  35.        if thistime = lastime then
  36.         do
  37.     'go -k 'ftproc /* process killer. ftproc is the PID */
  38.         abort = 1
  39.         signal Ttyl
  40.         end
  41.         else b = 0 
  42.         lastime = thistime
  43.        end
  44.      end
  45.      else a = a + 1
  46.       say 'Must be doing mail....waiting 5 mins.'
  47.       Call SysSleep 300
  48.      b = b + 1
  49.     end
  50.  
  51.    When Stream(maxflg,'C', 'Query Exists') <>' ' Then
  52.     Do
  53.     elapsed = time('e')
  54.     if elapsed > 3600 then signal Ttyl 
  55.      say 'Someones on the BBS....waiting 5 mins.'
  56.     Call SysSleep 300
  57.      b = b + 1
  58.     end
  59.  
  60.    When Stream(binkflg,'C', 'Query Exists') <>' ' Then
  61.     Do
  62.     elapsed = time('e')
  63.     if elapsed > 3600 then signal Ttyl 
  64.      say 'Someones on the mailer....waiting 5 mins.'
  65.     Call SysSleep 300
  66.      b = b + 1
  67.     end
  68.  
  69.    Otherwise
  70.      do
  71.      signal ttyl
  72.      end
  73.  
  74.  end /* Select */
  75. end /* Do Forever */
  76.  
  77. Ttyl:
  78. rc=doscreat(hangflg) /* Set process flag */
  79. IF rc <> 1 Then say 'Error creating hangup flagfile.!'
  80. if abort = 1 then 
  81.  do
  82.  del flg' > nul: 2>&1'
  83.  del hisbsy' > nul: 2>&1'
  84.  end
  85. New=Directory(tcpbin)
  86. 'pppkill > nul: 2>&1'
  87. exit
  88.